define(['tile.m', 'menu.m'], 
	function(TileManager, MenuManager) {

		/*Define 'core/boilerplate' dependency to access Boilerplate*/
		// Boilerplate.help();

	    var Game = function(Config) {
			/*Construct Game Controler*/
			this.stop = false;
			this.currentTime = +new Date();
			this.secondsElapsed = 0;
			this.parent = Config.parent !== undefined ? Config.parent : false;
		}

		Game.prototype = {
			init : function() {
				/*Initialize game managers*/
				TileManager.init();
				MenuManager.init('HTML');

				// Register Events
				var parent = this.parent;
				var input = parent.mInput;
				var canvas = parent.scene.canvas;
				input.registerEvent(canvas, 'tap', function() { MenuManager.functions.Pause(); });
				input.registerEvent(canvas, 'tap', function() { log('Tap 2'); });
			},
			update : function() {
				/* Update time */
				if (interval(this.currentTime, 1)) {
					this.currentTime = +new Date();
					this.secondsElapsed++;
				}

				debug('Game is running since '+this.secondsElapsed+' seconds');

				/*Game loop - Update game managers*/
				TileManager.update();
				MenuManager.update();
			},
			gameOver : function() {
				this.stop = true;
			}
		}

		return Game;
	}
);